home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / modelers / geomview / source.lha / Geomview / src / bin / trigrp / group.c < prev    next >
C/C++ Source or Header  |  1993-01-29  |  1KB  |  56 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3. #include "geom.h"
  4. #include "trigrp.h"
  5.  
  6. int debug2 = 0;
  7. char *grpnames[] = {"g233","g234","g235","g236","g237"};
  8.  
  9. char default_group_path[] = "./groups";
  10. char *group_path;
  11.     
  12.  
  13. die(fmt, p1, p2, p3)
  14.     char *fmt;
  15.     long p1, p2, p3;
  16. {
  17.     fprintf(stderr, fmt, p1, p2, p3);
  18.     fputc('\n', stderr);
  19.     exit(1);
  20. }
  21.  
  22. get_group_path()
  23. {
  24.   char *geomdata;
  25.   char grouppath[512];
  26.   extern char *getenv();
  27.   group_path = NULL;
  28.   
  29.   geomdata = getenv("GEOMDATA");
  30.   if (!geomdata) {
  31.     fprintf(stderr, "The GEOMDATA environment variable is not set.\n");
  32.     exit();
  33.   }
  34.   if (access(geomdata, 4) == 0) {
  35.     sprintf(grouppath, "%s/groups", getenv("GEOMDATA"));
  36.     group_path = strdup(grouppath);
  37.   }
  38.   else {
  39.     fprintf(stderr, "Problem with GEOMDATA variable.\n");
  40.     fprintf(stderr, "Either \"%s\" does not exist or is not readable.\n",
  41.         geomdata);
  42.     exit(0);
  43.   }
  44. }
  45.  
  46. init_groups()
  47. {
  48.     int i;
  49.     char filename[64];
  50.     
  51.     get_group_path();
  52.     /* precompute generators for the 3 platonic groups 233,234, 235 */
  53.     compute_gen();
  54. }
  55.  
  56.